import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [

    {
      path: '/',
      name: 'Index',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/IndexView.vue'),
      children: [
        {
          path: '/home',
          name: 'home',
          component: HomeView,
        },
        {
          path: '/about',
          name: 'about',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/AboutView.vue'),
        },
        {
          path: '/Management',
          name: 'Management',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/Traceability/ManagementView.vue'),
        },
        {
          path: '/Details',
          name: 'Details',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/Traceability/DetailsView.vue'),
          children: [
            {
              path: '/cultivation',
              name: 'cultivation',
              component: () => import('../views/Traceability/CultivationView.vue'),
            },
            {
              path: '/slaughter',
              name: 'slaughter',
              component: () => import('../views/Traceability/SlaughterView.vue'),
            },
            {
              path: '/Processing',
              name: 'Processing',
              component: () => import('../views/Traceability/ProcessingView.vue'),
            },
          ]
        },
      ]
    },
  ],
})

export default router
